const spider = require('./spider');

// 格式化用户名称
let formatUserName = async userlistArr => {
  const objArr = [];
  for (let i = 0; i < userlistArr.length; i++) {
    const item = userlistArr[i];
    let obj = await getUserNameArrItem(item);
    objArr.push(obj);
  }
  return objArr;
};

// 拉取用户详细信息
let getUserNameArrItem = async userItem => {
  let obj = { ...userItem, formatUserName: '' };
  // const { gameuserid } = userItem;
  // const res = await spider.getUserDetailInfo(gameuserid);
  // if (res.errno === 0) {
  //   const { name } = res;
  //   Object.assign(obj, { formatUserName: name });
  // }
  return obj;
};

module.exports = {
  formatUserName
};
